#!/bin/bash

# ip_list="172.16.17.82 172.16.24.220"
# k8s 节点
ip_list=`sudo kubectl get nodes|awk '{print $1}'|grep -v NAME`
port=2375

function main() {

for ip in $ip_list
do
echo $ip $port
result=`echo -e "\n" |telnet $ip $port 2>/dev/null | grep Connected | wc -l`

if [ $result -ne 1 ]
then
   echo `date`  telnet $ip $port Connected refused >> $HOME/docker_check.log
   echo 1
fi

done

}

function main_dialing() {

for ip in $ip_list
do
result=`echo -e "\n" |telnet $ip $port 2>/dev/null | grep Connected | wc -l`
if [ $result -ne 1 ]
then
   echo $ip $port exception
   exit
fi

done

echo success

}


main


